package com.epalmpay.job;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.epalmpay.enumdef.CommonEnum.RunStatus;
import com.epalmpay.enumdef.CommonEnum.TaskType;
import com.epalmpay.service.operator.ISysLogService;
import com.epalmpay.service.trade.ITradeCheckService;
import com.epalmpay.util.DateUtil;

@Component
public class TradeSettedResloveTaskJob {

	//完成对账文件的解析
	
private static final Logger logger = LoggerFactory.getLogger(TradeSettedResloveTaskJob.class);
	
@Resource
private ISysLogService sysLogService;

@Resource
private ITradeCheckService tradeCheckService;

	//每天4点解析一下对账文件 
	//@Scheduled(cron = "0 4 * * * ?")
	public void job() {
		
		
		tradeCheckService.finishTradeCheck();
		
		StringBuffer sb = new StringBuffer(); 
		logger.info(sb.append("计划任务:")
				.append(TaskType.FlowTradeNotifyTask.getName())
				.append("通知日期:").append(DateUtil.fomatDate(new Date(), DateUtil.sdfDays)).append("执行成功！").toString());
		try {
			sysLogService.recordSysTaskLog(TaskType.FlowTradeNotifyTask.getType(),
					new Date(), RunStatus.Success.getType(),
					null);
		} catch (Exception e1) {
			e1.printStackTrace();
		}
	}
}
